﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.DescendanttransferCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.DescendanttransferCommandHandler
{
    /// <summary>
    /// 删除后裔转种
    /// </summary>
    public class DelDescendanttransferCommandHandler : IRequestHandler<DelDescendanttransferCommand, int>
    {
		/// <summary>
		/// 接口
		/// </summary>
		private readonly IDescendantTransferService _descendantTransferService;
		/// <summary>
		/// 构造函数
		/// </summary>
		/// <param name="descendantTransferService"></param>

		public DelDescendanttransferCommandHandler(IDescendantTransferService descendantTransferService)
		{
			_descendantTransferService = descendantTransferService;
		}
		/// <summary>
		/// 删除后裔转种
		/// </summary>
		public async Task<int> Handle(DelDescendanttransferCommand request, CancellationToken cancellationToken)
        {
            var result= await _descendantTransferService.DelDescendanttransfer(request.eartag);
            return result;
        }
    }
}
